from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site 
from django.utils.translation import ugettext as _
from django.contrib.syndication.feeds import Feed

class Bookmark(models.Model):
  user_id     = models.ForeignKey(User, verbose_name=_('Author'),editable=False)
  date        = models.DateTimeField(default=datetime.now())
  title       = models.CharField(max_length=40)
  description = models.CharField(max_length=150)
  url         = models.CharField(max_length=300)
  
  def __unicode__(self):
       return self.title
  
  def get_absolute_url(self):
    #return "/people/%i/" % self.id
    return self.url

    
## ADMIN SECTION
from django.contrib import admin

class BookmarkAdmin(admin.ModelAdmin):
   search_fields = ('title', 'date')
   list_display  = ('title', 'url')  
   def list_title(self):
       return self.pub_date.date() == datetime.date.today()
 

admin.site.register(Bookmark, BookmarkAdmin)

